package zoran.wang;

import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import zoran.wang.controller.PersonController;
import zoran.wang.entity.Person;
import zoran.wang.service.PersonService;

/**
 * description：
 *
 * @author wangzhuo
 * @date 2022/3/19 16:28
 * @Email zoranwang@yeah.net
 */
public class AnnoTest {

    private ApplicationContext ctx;

    private String value;

    @Before
    public void createContext(){
        ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
    }

    @Test
    public void test01(){

        Person person1 = ctx.getBean("person", Person.class);
        Person person2 = ctx.getBean("person", Person.class);

        System.out.println(person1);
        System.out.println(person2);

    }

    @Test
    public void test02(){

        PersonController personController = ctx.getBean("personController", PersonController.class);

        PersonService personService = ctx.getBean("personService", PersonService.class);

        System.out.println("personController = " + personController);

        System.out.println("personService = " + personService);

    }

}
